using System;
namespace DesignPattern.Behavioral.Interpreter
{
    public class InterpreterPattern
    {
        public static void Test()
        {
            Func<OrExpress> getMaleExpress = () => {
                return new OrExpress(
                    new TerminalExpress("John"),
                    new TerminalExpress("Robert")
                );
            };

            Func<AndExpress> getMarriedWomanExpress = () => {
                return new AndExpress(
                    new TerminalExpress("Julia"),
                    new TerminalExpress("Married")
                );
            };

            System.Console.WriteLine($"John is male? {getMaleExpress().Interpreter("John")}");
            System.Console.WriteLine($"Julia is married? {getMarriedWomanExpress().Interpreter("Julia Married")}");
        }
    }
}